package io.focus.mijin.zuul.ratelimit;

import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.web.bind.annotation.*;

@EnableZuulProxy
@SpringCloudApplication
public class RateLimitBootstrap {

    public static void main(String[] args) {
        SpringApplication.run(RateLimitBootstrap.class, args);
    }

    /**
     * 示例Controller
     *
     * @author: IceWee
     * @date: 2017/8/16
     */
    @RestController
    @RequestMapping(path = "/services")
    public class SampleController {

        @GetMapping("/serviceA")
        public String serviceA() {
            return "serviceA";
        }

        @PostMapping("/v1/test/send_code")
        public String sendCode(@RequestParam(value = "phone") String phone) {
            System.out.println(" phone:: " + phone);
            return "sendCode";
        }

        @GetMapping("/serviceB")
        public String serviceB() {
            return "serviceB";
        }

        @GetMapping("/serviceC/{paramName}")
        public String serviceD(@PathVariable String paramName) {
            return "seriviceC " + paramName;
        }

        @PostMapping("/v1/sd")
        public String sendCode11(@RequestParam(value = "phone") String phone) {
            System.out.println(" phone:: " + phone);
            return "sendCode";
        }

    }

}
